package org.dt.common.sequence;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.FieldDefaults;

import java.io.Serializable;

/**
 * 左闭右闭区间
 *
 * @author yujiadong
 * @create: 2019/01/08 14:10
 */
@Getter
@Setter
@ToString
@AllArgsConstructor
@FieldDefaults(makeFinal = true)
public class Sequence implements Serializable {
    public static final  Sequence EMPTY            = new Sequence(0, -1);
    private static final long     serialVersionUID = 4582091697989449816L;
    protected            long     lowerBound;
    protected            long     upperBound;

    long width() {
        return upperBound - lowerBound + 1;
    }
}